﻿namespace UnityTemplate.ApiModel
{
    /// <summary>
    /// 全局响应信息
    /// </summary>
    public class BaseResponse
    {        
        public string TraceId { get; set; }
        /// <summary>
        /// 状态码
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public object Data { get; set; }

        /// <summary>
        /// 信息
        /// </summary>
        public string Title { get; set; }

        public object Errors { get; set; }

        public static BaseResponse OK(object data)
        {
            return new BaseResponse()
            {
                Data = data,
                Status = ApiStatus.OK,
            };
        }

        public static BaseResponse BadRequest(string str, int code)
        {
            return new BaseResponse()
            {
                Title = str,
                Status = code
            };
        }
    }
}
